package com.rjhch.tonglink;

import com.tongtech.tlq.base.TlqConnContext;
import com.tongtech.tlq.base.TlqMessage;

import java.io.File;

public class TestMain {

    public static void main(String[] args) throws Exception {
//        String fileName = "/Users/hadoop/Downloads/tonglink/TongLINKQ8.1快 速使用手册.pdf";
        String fileName = args[0];
        long start = System.currentTimeMillis();
        TlqConnContext context = BaseUtils.getContext("192.168.100.156", 10261);
        BaseUtils.sendMsg(context, "lq", Constants.Enums.MsgType.FILE, fileName, "");
        long end = System.currentTimeMillis();
        System.out.println((end - start) / 1000);
	    BaseUtils.GetMsg(context, "lq", 2, new MsgHandle() {
			@Override
			public void dealMsg(TlqMessage msgInfo) {
				if ((int) msgInfo.MsgType == 1) {
					byte[] msgData = msgInfo.getMsgData();
					System.out.println("file");
					System.out.println(new String(msgData));
				}else {
					System.out.println("");
				}
			}
		},new File("./"));
    }
}
